{{ template "header.html" . }}

{{ $usernamePrompt := .UsernamePrompt | lower }}
{{ if eq .ReqPath "/sky/issuer/auth/local/login" }}
  {{ $usernamePrompt = "username" }}
{{ end }}

<div class="theme-panel">
  <h2 class="theme-heading">log in to your account</h2>
  <form method="post" action="{{ .PostURL }}" autocomplete="off">
    <div class="theme-form-row">
      <div class="theme-form-label">
        <label for="userid">{{ $usernamePrompt }}</label>
      </div>
	  <input tabindex="1" required id="login" name="login" type="text" class="theme-form-input" placeholder="{{ $usernamePrompt }}" autocomplete="off"{{ if .Username }} value="{{ .Username }}" {{ else }} autofocus {{ end }}/>
    </div>
    <div class="theme-form-row">
      <div class="theme-form-label">
        <label for="password">password</label>
      </div>
	  <input tabindex="2" required id="password" name="password" type="password" class="theme-form-input" placeholder="password" autocomplete="off" {{ if .Invalid }} autofocus {{ end }}/>
    </div>

    {{ if .Invalid }}
      <div id="login-error" class="dex-error-box">
        invalid {{ $usernamePrompt }} and password.
      </div>
    {{ end }}

    <div class="theme-btn-wrapper">
      <div class="theme-form-row">
        <button tabindex="3" id="submit-login" type="submit" class="dex-btn theme-btn-primary">submit</button>
      </div>
      {{ if .BackLink }}
      <div class="theme-form-row">
        <button tabindex="3" id="cancel-back" type="button" class="dex-btn theme-btn-cancel" onclick="location.href='/sky/login'">cancel</button>
      </div>
      {{ end }}
    </div>

  </form>
</div>

{{ template "footer.html" . }}
